package com.app;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;


/**
 * Created by Lichaojie on 2017/3/4. It's a beautiful day.
 */
@ComponentScan
@SpringBootApplication
@EnableScheduling
@EnableTransactionManagement
public class Application extends SpringBootServletInitializer {

//    public Application() {
//        super();
//        setRegisterErrorPageFilter(false); // <- this one
//    }

    //你猜这一行是干什么的？
    //=============================for war========================================
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Application.class);
    }
    //=============================for war========================================

//    /**
//     * 如果添加的是 spring-boot-starter-jdbc 依赖，框架会默认注入 DataSourceTransactionManager 实例。
//     * 如果添加的是 spring-boot-starter-data-jpa 依赖，框架会默认注入 JpaTransactionManager 实例。
//     * 可主动配置 TransactionManager
//     * @param platformTransactionManager
//     * @return
//     */
//    @Bean
//    public Object testBean(PlatformTransactionManager platformTransactionManager) {
//        System.out.println(">>>>>>>>>>" + platformTransactionManager.getClass().getName());
//        return new Object();
//    }

    public static void main(String[] args)throws Exception{
        SpringApplication.run(Application.class,args);
    }
}
